Ext.define('AmpleHarvest.views.article.cAreaWest',
{
	extend			: 'Ext.panel.Panel',
	alias			: 'widget.ampleharvest-views-article-careawest',
	requires		:
	[
			"AmpleHarvest.objects.paging.cPages",
			"AmpleHarvest.objects.files.cFiles",
			"AmpleHarvest.objects.contentHighlight.cHighlight"
	],
	title			: 'Navigation',
	width			: 300,
	animCollapse	: false,
	collapsible		: true,
	resizable		: true,
	layoutActivate	: true,
	layout			: 'accordion',
	iconCls			: 'toolbar-article-navigation',
	m_str_CurID		: "",
	listeners		:
	{
		objectResponse	: function(object)
		{
			this.add(object);
			if (this.layoutActivate)
			{
				this.ahCaller.add(this);
				this.layoutActivate = false;
			}
		}
	},

	initComponent	: function()
	{
		var obj_This = this;
		
		this.m_obj_FilesWin = Ext.create("AmpleHarvest.objects.files.cFiles",
				{
					m_str_id : this.m_str_id,
					ahCaller : this
				});
		
		this.m_obj_FilesWin = Ext.create("AmpleHarvest.objects.paging.cPages",
				{
					m_str_id : this.m_str_id,
					ahCaller : this
				});

		this.m_obj_FilesWin = Ext.create("AmpleHarvest.objects.contentHighlight.cHighlight",
				{
					m_str_id : this.m_str_id,
					ahCaller : this
				});
		
		this.callParent();
	},

	setCurID		: function(str_ID)
	{
		this.m_str_CurID = str_ID;
	},

	setActive		: function()
	{
		this.items.each(function(obj_Data, int_Index, int_Total)
				{
					if (obj_Data.hasData())
					{
						// found a panel to activate no need to continue
						// return false;
					}
					else
					{
						obj_Data.collapse();
					}
				}, this);

	}//,

//	get_JsonObject	: function(JsonObject)
//	{
//		var panel_num = 0;
//		console.log(JsonObject);
//		if (JsonObject.pages)
//		{
//			this.m_obj_PagesWin = Ext.create("AmpleHarvest.objects.paging.cPages");
//			this.m_obj_PagesWin.setCurID(this.m_str_CurID);
//			this.m_obj_PagesWin.add_JsonObject(JsonObject.pages);
//			this.add(this.m_obj_PagesWin);
//			panel_num++;
//		}
//		if (JsonObject.attachments)
//		{
//			this.m_obj_FilesWin = Ext.create("AmpleHarvest.objects.files.cFiles");
//			this.m_obj_FilesWin.add_JsonObject(JsonObject.attachments);
//			this.add(this.m_obj_FilesWin);
//			panel_num++;
//		}
//		if (JsonObject.breadcrumb)
//		{
//			this.m_obj_CrumbsWin = Ext.create("AmpleHarvest.objects.breadcrumbs.cBreadcrumbs");
//			this.m_obj_CrumbsWin.add_JsonObject(JsonObject.breadcrumb);
//			this.add(this.m_obj_CrumbsWin);
//			panel_num++;
//		}
//		if (JsonObject.highlight)
//		{
//			// alert(JsonObject.highlight);
//			this.m_obj_HighlightWin = Ext.create("AmpleHarvest.objects.contentHighlight.cHighlight");
//			this.m_obj_HighlightWin.add_JsonObject(JsonObject.highlight);
//			this.add(this.m_obj_HighlightWin);
//			panel_num++;
//		}
//		if (panel_num)
//		{
//			this.setTitle(this.title + ' (' + panel_num + ')');
//		}
//		this.setActive();
//	}
}
);
